<script src="/themes/{{staticforder}}/js/avalon-ms-pager.js?version={{siteInfo.version}}" type="text/javascript"></script>
<div class="my-contents" ms-controller="my-contents">
    {% include "./modal.html" %}
    <!-- Nav tabs -->
    <ul class="nav nav-tabs" role="tablist">
        <li role="presentation" class="active">
            <a href="#home" aria-controls="home" role="tab" data-toggle="tab">
                <i aria-hidden="true" class="fa fa-pencil"></i>&nbsp;{{lk.lc_myDocument}}</a>
        </li>
        <li role="presentation">
            <a href="#myMessages" aria-controls="myMessages" role="tab" data-toggle="tab">
                <i aria-hidden="true" class="fa fa-comment"></i>&nbsp;{{lk.lc_myMessage}}</a>
        </li>
        <li role="presentation">
            <a href="#myJoinTopics" aria-controls="myJoinTopics" role="tab" data-toggle="tab">
                <i aria-hidden="true" class="fa fa-file-text"></i>&nbsp;{{lk.lc_myJoinComment}}</a>
        </li>
        <li role="presentation">
            <a href="/users/userAddContent" aria-controls="settings">
                <i aria-hidden="true" class="fa fa-edit"></i>&nbsp;{{lk.lc_myPostArticels}}</a>
        </li>
    </ul>

    <!-- Tab panes -->
    <div class="tab-content">
        <div role="tabpanel" class="tab-pane active" id="home">
            <div :if="@myContentList.length == 0">
                <div class="no-contents">
                    <div class="um-profile-note">
                        <i class="fa fa-frown-o"></i>
                        <span>{{lk.lc_no_myDocument}}</span>
                    </div>
                </div>
            </div>
            <div class="myContentList" :if="@myContentList.length > 0">
                <div ms-for="(index,el) in @myContentList">
                    <div class="discription ">
                        <h2 class="post-title ">
                            <a ms-if="@el.state" ms-attr="{href:'/details/'+el._id+'.html'}" target="_blank " ms-text="@el.title"></a>
                            <a ms-if="!@el.state" ms-text="@el.title"></a>
                        </h2>
                        <div class="post-content" ms-html="@el.discription"></div>
                        <ul class="post-meta ">
                            <li>
                                <i class="fa fa-clock-o " aria-hidden="true "></i>&nbsp;&nbsp;
                                <span ms-text="@el.date"></span>
                            </li>
                            <li>
                                <i class="fa fa-eye " aria-hidden="true "></i>&nbsp;&nbsp;
                                <span ms-text="@el.clickNum"></span>
                            </li>
                            <li>
                                <i class="fa fa-comment " aria-hidden="true "></i>&nbsp;&nbsp;
                                <span ms-text="@el.commentNum"></span>
                            </li>
                        </ul>
                    </div>
                </div>
            </div>
            <div class="text-center"><wbr ms-widget="{is:'ms-pager', onPageClick: @contentPageClick, totalPages:@contentTotalPage}" /></div>
        </div>
        <div role="tabpanel" class="tab-pane" id="myMessages">
            <div :if="@myMessageList.length == 0">
                <div class="no-contents">
                    <div class="um-profile-note">
                        <i class="fa fa-frown-o"></i>
                        <span>{{lk.lc_no_myMessage}}</span>
                    </div>
                </div>
            </div>
            <div class="myMessageList" :if="@myMessageList.length > 0">
                <div ms-for="(index,el) in @myMessageList">
                    <ul>
                        <li>
                            <div :class="['notify-title',(@el.isRead?'isRead':'noRead')]"><i class="fa fa-angle-right"
                                    ms-on-click="showMessageDetails($event,el)"></i><span ms-html="@el.notify.title"></span></div>
                            <span class="notify-content" ms-html="@el.notify.content"></span>
                            <div class="opt pull-right">
                                <button ms-on-click="@deleteNotify(el._id)" type="button" class="btn btn-danger btn-xs">删除</button>
                            </div>
                        </li>
                    </ul>
                </div>
            </div>
            <div class="text-center"><wbr ms-widget="{is:'ms-pager', onPageClick: @messagePageClick, totalPages:@messageTotalPage}" /></div>

        </div>
        <div role="tabpanel" class="tab-pane" id="myJoinTopics">
            <div :if="@myJoinTopicsList.length == 0">
                <div class="no-contents">
                    <div class="um-profile-note">
                        <i class="fa fa-frown-o"></i>
                        <span>{{lk.lc_no_myJoinComment}}</span>
                    </div>
                </div>
            </div>
            <div class="myJoinTopicsList" :if="@myJoinTopicsList.length > 0">
                <div>
                    <ul class="replyList">
                        <li ms-for="(index,el) in @myJoinTopicsList">
                            <time ms-text="@el.date"></time>
                            <h4>
                                <a href="#">{{userInfo.userName}}</a>&nbsp;发表在&nbsp;
                                <a ms-attr="{href:'/details/'+el.contentId._id+'.html'}" class="" ms-text="@el.contentId.title"></a>
                            </h4>
                            <blockquote ms-text="@el.content"></blockquote>
                        </li>
                    </ul>
                </div>
            </div>
            <div class="text-center"><wbr ms-widget="{is:'ms-pager', onPageClick: @joinTopicPageClick, totalPages:@joinTopicsTotalPage}" /></div>
        </div>
        <!-- <div role="tabpanel" class="tab-pane" id="settings">...</div> -->
    </div>

</div>

<script>
    $(function () {
        $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
            var targetId = e.target.hash;
            if (targetId.indexOf('myMessages') >= 0) {
                // 获取用户消息列表
                getUserRelevantList('getUserNotifys', 'myMessages', 1)
            } else if (targetId.indexOf('home') >= 0) {
                getUserRelevantList('getUserContents', 'myContents', 1)
            } else if (targetId.indexOf('myJoinTopics') >= 0) {
                getUserRelevantList('getUserReplies', 'myJoinTopics', 1)
            }
        })
    })
    // 获取用户投稿列表
    getUserRelevantList('getUserContents', 'myContents', 1);

</script>